//
//  CCYToolTableViewController.m
//  模拟-百思不得姐
//
//  Created by 程春玉 on 16/8/10.
//  Copyright © 2016年 colin. All rights reserved.
//

#import "CCYToolTableViewController.h"

@interface CCYToolTableViewController ()

@end

@implementation CCYToolTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 2;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
    if (indexPath.row == 0) {
        XMGLog(@"%@", [[NSBundle mainBundle] infoDictionary]);
        NSString *version = [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"];
        cell.textLabel.text = [NSString stringWithFormat:@"当前版本：%@", version];
    } else {
        cell.textLabel.text = @"退出当前账号";
    }
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    EMError *error = [[EMClient sharedClient] logout:YES];
    if (!error) {
        [[NSNotificationCenter defaultCenter] postNotificationName:@"loginOut" object:nil];
        [self.navigationController popViewControllerAnimated:YES];
    }
}


@end
